/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.namabank.db;

import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Nguyen Tran Hien
 */
public class OracleDBUtil implements InterfaceDBUtil {
    public OracleDBUtil(){}

    public String datetimeString(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        String res = "to_date('"
                + (cal.get(Calendar.MONTH) + 1) + "/"
                + cal.get(Calendar.DAY_OF_MONTH) + "/"
                + cal.get(Calendar.YEAR) + " "
                + cal.get(Calendar.HOUR_OF_DAY) + ":"
                + cal.get(Calendar.MINUTE) + ":"
                + cal.get(Calendar.SECOND)
                + "', 'MM/DD/YYYY HH24:MI:SS')";
        return res;
    }
    public String dateString(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        String res = "to_date('"
                + (cal.get(Calendar.MONTH) + 1) + "/"
                + cal.get(Calendar.DAY_OF_MONTH) + "/"
                + cal.get(Calendar.YEAR)
                + "', 'MM/DD/YYYY')";
        return res;
    }
    public String monthString(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        String res = "to_date('"
                + (cal.get(Calendar.MONTH) + 1) + "/"
                + cal.get(Calendar.YEAR)
                + "', 'MM/YYYY')";
        return res;
    }
}
